package com.xczl.demo.domain.filter;

import java.math.BigDecimal;

import org.apache.commons.lang3.StringUtils;

import com.xczl.demo.domain.Goods;

public class GoodsFilter extends Goods {

	public static final String ORDER_BY_PRICE = "mode1";
	/**
	 * 开始价格
	 */
	private BigDecimal startPrice;

	/**
	 * 结束价格
	 */
	private BigDecimal endPrice;

	/**
	 * 排序
	 */
	private String orderBy;

	public BigDecimal getStartPrice() {
		return startPrice;
	}

	public void setStartPrice(BigDecimal startPrice) {
		this.startPrice = startPrice;
	}

	public BigDecimal getEndPrice() {
		return endPrice;
	}

	public void setEndPrice(BigDecimal endPrice) {
		this.endPrice = endPrice;
	}

	public String getOrderBy() {
		if (StringUtils.equals(ORDER_BY_PRICE, orderBy)) {
			return "order by price desc";
		}
		return "order by price";
	}

	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}

	@Override
	public String getName() {
		if (StringUtils.isNotBlank(super.getName())) {
			return "%" + super.getName() + "%";
		}
		return null;
	}
}
